﻿//////////////////////////////////////////////////////////////////////////////////////////////////////
//Name: Bartosz
//FullName: Adamczewski
//Project: InternalClasses
//Component: InternalClasses
//StartDate: 2009-08-17 19:29:04
//EndDate: 2009-08-17 19:29:04
//Description: The implementation of InternalClasses component.
//Rights:  Copyright (c) Bartosz Adamczewski
////////////////////////////////////////////////////////////////////////////////////////////////////

#region imports.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Specialized;
using System.Reflection.Emit;
using System.Reflection;

#endregion

namespace InternalClasses.Dynamic
{
    /// <summary>
    /// This is a fluent interface for Type Builder.
    /// </summary>
    public interface IDynamicTypeBuilder
    {
        /// <summary>
        /// Defines the type.
        /// </summary>
        /// <param name="sourceType">Type of the source.</param>
        /// <param name="interfaceType">Type of the interface.</param>
        /// <returns></returns>
        IDynamicTypeBuilder DefineType(Type sourceType, Type interfaceType);
        /// <summary>
        /// Opens the method for creation.
        /// </summary>
        /// <returns></returns>
        IDynamicTypeBuilder OpenMethodForCreation(MethodInfo method);
        /// <summary>
        /// Adds the injected method.
        /// </summary>
        /// <param name="methodToInject">The method to inject.</param>
        /// <param name="injectionType">Type of the injection.</param>
        /// <returns></returns>
        IDynamicTypeBuilder AddInjectedMethod(MethodInfo methodToInject, InjectionType injectionType, object[] externalParameters);
        /// <summary>
        /// Creates the method.
        /// </summary>
        /// <returns></returns>
        IDynamicTypeBuilder CreateMethod();
        /// <summary>
        /// Creates the instance, calling the default constructor on it.
        /// </summary>
        /// <returns></returns>
        object CreateInstance();
        /// <summary>
        /// Creates the instance, calling the constructor that matches the parameters.
        /// </summary>
        /// <returns></returns>
        object CreateInstance(params object[] parameters);

        /// <summary>
        /// Creates the type, that's need to be Activated in order to be used as an object.
        /// </summary>
        /// <returns></returns>
        Type CreateType();
    }
}
